//
//  AppDelegate.h
//  000-ChatChair
//
//  Created by 李晓东 on 2018/4/16.
//  Copyright © 2018年 PeanutXu. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <XMPPFramework/XMPPFramework.h>
#import "Constant.h"

@protocol LoginRegistDelegate
- (void)loginSuccess;
@end

@protocol RosterListDelegate
- (void)onOrOff:(NSString*)userId isOn:(BOOL) isOn;
- (void)refresh;
@end

@protocol RoomListDelegate
- (void)listRooms:(DDXMLElement*) ele;
@end

@protocol ChatDelegate
- (void)didReceiveMessage:(XMPPMessage*) messagePath;
- (NSString *)getCurrentSession;
@end

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, strong) XMPPStream *xmppStream;
@property (strong, nonatomic) dispatch_queue_t queue;
@property (nonatomic, strong) id<LoginRegistDelegate> loginRegistDelegate;
@property (nonatomic, strong) id<RosterListDelegate> rosterListDelegate;
@property (nonatomic, strong) id<RoomListDelegate> roomListDelegate;
@property (nonatomic, strong) id<ChatDelegate> chatDelegate;

@property (nonatomic, strong) XMPPRoomCoreDataStorage *roomStorage;
@property (nonatomic, strong) NSMutableDictionary<NSString *, NSMutableArray<XMPPElement *>*> *historyMessage;

- (void)connect:(BOOL)isRegist;
@end

